{extend name="base" /}
{block name="body"}
<div class="layui-card">
    <div class="layui-card-body">
        <form action="{:request()->url()}" class="layui-form" method="post">
            <div class="layui-col-md6">
                <div class="layui-form-item">
                    <label class="layui-form-label">客户名称</label>
                    <div class="layui-input-block">
                        <input name="name" placeholder="请输入客户名称" type="text" class="layui-input" value="{$data.name|default=''}" lay-verType="tips" lay-verify="required" required autocomplete="off"/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">联系人</label>
                    <div class="layui-input-block">
                        <input name="contact" placeholder="请输入联系人姓名" type="text" class="layui-input" value="{$data.contact|default=''}" lay-verType="tips" required autocomplete="off"/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">手机号</label>
                    <div class="layui-input-block">
                        <input name="mobile" placeholder="请输入手机号" type="text" class="layui-input" value="{$data.mobile|default=''}" lay-verType="tips" lay-verify="required|phone" required autocomplete="off"/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">客户分类</label>
                    <div class="layui-input-block">
                        <select name="classify">
                            <option value="">请选择</option>
                            {foreach name=":get_customer_config('classify')" item="v"}
                            <option value="{$v.id}" {if condition="isset($data) and $data.classify eq $v.id"}selected="selected"{/if}>{$v.name}</option>
                            {/foreach}
                        </select>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">重要程度</label>
                    <div class="layui-input-block">
                        <select name="star">
                            <option value="1" {if condition="isset($data) and $data.star eq '★'"}selected="selected"{/if}>★</option>
                            <option value="2" {if condition="isset($data) and $data.star eq '★★'"}selected="selected"{/if}>★★</option>
                            <option value="3" {if condition="isset($data) and $data.star eq '★★★'"}selected="selected"{/if}>★★★</option>
                            <option value="4" {if condition="isset($data) and $data.star eq '★★★★'"}selected="selected"{/if}>★★★★</option>
                            <option value="5" {if condition="isset($data) and $data.star eq '★★★★★'"}selected="selected"{/if}>★★★★★</option>
                        </select>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">所在省市</label>
                    <div class="layui-input-block">
                        <input id="demoCascader1" name="shengshi" value="{$data.province|default=''},{$data.city|default=''},{$data.area|default=''}" placeholder="请选择" class="layui-hide"/>
                    </div>
                </div>
                
                
               
            </div>
            <div class="layui-col-md6">
                <div class="layui-form-item">
                    <label class="layui-form-label">头像</label>
                    <div class="layui-input-block">
                        <div class="layui-input-block">
                            <input type="hidden" name="avatar" value="{$data.avatar|default='/static/img/no_image_100x100.jpg'}" autocomplete="off" placeholder="" class="layui-input">
                            <div class="layui-upload-list ajax-avatar" style="border:2px solid #F0F2F5;width:78px;">
                                <img class="layui-upload-img" id="test-upload-normal-img" src="{$data.avatar|default='/static/img/no_image_100x100.jpg'}" width="78" height="78">
                            </div>
                            
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">固定电话</label>
                    <div class="layui-input-block">
                        <input name="phone" placeholder="请输入固定电话" type="text" value="{$data.phone|default=''}" class="layui-input" lay-verType="tips" autocomplete="off"/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">客户来源</label>
                    <div class="layui-input-block">
                        <select name="comefrom">
                            <option value="">请选择</option>
                            {foreach name=":get_customer_config('comefrom')" item="v"}
                            <option value="{$v.id}" {if condition="isset($data) and $data.comefrom eq $v.id"}selected="selected"{/if}>{$v.name}</option>
                            {/foreach}
                        </select>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">客户状态</label>
                    <div class="layui-input-block">
                        <select name="status">
                            <option value="">请选择</option>
                            {foreach name=":get_customer_config('status')" item="v"}
                            <option value="{$v.id}" {if condition="isset($data) and $data.status eq $v.id"}selected="selected"{/if}>{$v.name}</option>
                            {/foreach}
                        </select>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">详细地址</label>
                    <div class="layui-input-block">
                        <input name="address" placeholder="请输入详细地址" type="text" value="{$data.address|default=''}" class="layui-input" lay-verType="tips" autocomplete="off">
                    </div>
                </div>
                
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">备注</label>
                <div class="layui-input-block">
                    <textarea name="remark" placeholder="请输入备注" class="layui-textarea">{$data.remark|default=''}</textarea>
                </div>
            </div>

            <div class="layui-form-item">
                <div class="layui-input-block">
                    <input name="province" type="hidden"><input name="city" type="hidden"><input name="area" type="hidden">
                    <button class="layui-btn" lay-filter="i" lay-submit="">保存</button>
                    <button class="layui-btn layui-btn-primary" type="reset">重置</button>
                </div>
            </div>
        </form>
    </div>
</div>
{/block}
{block name="js"}
<script type="text/javascript" src="/static/hqui/module/cascader/citys-data.js"></script>
<script>
    layui.use(['cascader'], function () {
        var $ = layui.jquery;
        var cascader = layui.cascader;
        var admin = layui.admin;
        
        // value也是中文而不是区号
        var data = cascader.getCityData(admin.util.deepClone(citysData));
        cascader.render({
            elem: '#demoCascader1',
            data: data
        });

    });
</script>
{/block}